<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link rel="stylesheet" href="https://cdn.bootcss.com/weui/1.1.3/style/weui.min.css">
  <link rel="stylesheet" href="https://cdn.bootcss.com/jquery-weui/1.2.1/css/jquery-weui.min.css">
  <link rel="stylesheet" href="https://jqweui.cn/dist/demos/css/demos.css">
</head>

<body>

  <header class='demos-header'>
    <h1 class="demos-title">我的</h1>
  </header>


  <div class="weui-cells weui-cells_form">
    <div class="weui-cell">
      <div class="weui-cell__hd"><label for="name" class="weui-label">姓名</label></div>
      <div class="weui-cell__bd">
        <input class="weui-input" id="name" type="text" value="" placeholder="请输入系统中登记过的姓名">
      </div>
    </div>
    <div class="weui-cell">
      <div class="weui-cell__hd"><label for="phone" class="weui-label">手机</label></div>
      <div class="weui-cell__bd">
        <input class="weui-input" id="phone" type="number" value="" placeholder="请输入系统中登记过的手机号码">
      </div>
    </div>
  </div>
  <a href="javascript:;" class="weui-btn weui-btn_primary" id="submit">查询</a>
  <section id="detail"></section>

  <script src="https://cdn.bootcss.com/jquery/1.11.0/jquery.min.js"></script>
  <script src="https://cdn.bootcss.com/fastclick/1.0.6/fastclick.min.js"></script>
  <script src="https://cdn.bootcss.com/jquery-weui/1.2.1/js/jquery-weui.min.js"></script>
  <script>
    $("#submit").click(function () {
      var name = $("#name").val();
      var phone = $("#phone").val();
      if (name != "" && phone != "") {
        $.ajax({
          url: "http://123.206.221.45/Api/getCustomerDeteil",
          type: 'GET',
          dataType: "jsonp",
          data: { name: name, phone: phone },
          success: function (data) {
            if (data.code == 0) {
              var inner="";
              $.each(data.data, function (i, item) {
                inner += "<div class=\"weui-form-preview\"><div class=\"weui-form-preview__bd\"><div class=\"weui-form-preview__item\"><label class=\"weui-form-preview__label\">就诊门店</label><span class=\"weui-form-preview__value\">"+item.cname+"</span></div><div class=\"weui-form-preview__item\"><label class=\"weui-form-preview__label\">就诊日期</label><span class=\"weui-form-preview__value\">"+item.case[0].date+"</span></div><div class=\"weui-form-preview__item\"><label class=\"weui-form-preview__label\">客户诉求</label><span class=\"weui-form-preview__value\">"+item.case[0].ask+"</span></div><div class=\"weui-form-preview__item\"><label class=\"weui-form-preview__label\">病例</label><span class=\"weui-form-preview__value\">"+item.case[0].content+"</span></div><div class=\"weui-form-preview__item\"><label class=\"weui-form-preview__label\">开具处方</label><span class=\"weui-form-preview__value\">"+item.case[0].prescription+"</span></div></div></div>"
              })
              $("#detail").html(inner);
            } else $.toast("服务器错误:" + data.msg, "forbidden");
          }
        });
      } else $.toast("姓名和手机号都需要输入", "text");
    })

  </script>
</body>

</html>